Skip to content

Handle missing identifiers in deprecated fields - #997

Merged
JPrevost merged 1 commit into
mainfrom
timx-746
Nov 12, 2026
Merged

JPrevost merged 1 commit into
mainfrom
timx-746

Conversation

@JPrevost

Copy link
Copy Markdown
Member

Return nil instead of raising an error when a record has no identifiers, and add a regression test.

This branch should return record with null isbns, production will return error for this query:

{
  recordId(id: "alma:9935045653306761") {
    title
    isbns
  }
}

https://mitlibraries.atlassian.net/browse/TIMX-746 Sentry: TIMDEX-6Q

Developer

  • No changes to view

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

Return nil instead of raising an error when a record has no identifiers, and add a regression test.

This branch should return record with null isbns, production will return error for this query:

```
{
  recordId(id: "alma:9935045653306761") {
    title
    isbns
  }
}
```

https://mitlibraries.atlassian.net/browse/TIMX-746
Sentry: TIMDEX-6Q

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change safely handles missing identifier data and adds regression coverage for the absent-key case, with no active review issues identified.

No open issues 🎉

What changed in this PR

Updates deprecated identifier field resolvers so records without an identifiers key return null instead of raising an error, with regression coverage for the missing-key case.

Changes:

  • Safely handles missing identifier data in deprecated identifier accessors.
  • Adds a regression test verifying isbns returns nil when identifiers are absent.
File Description
test/​graphql/​types/​record_type_test.rb Adds regression coverage verifying that isbns returns nil when the record lacks an identifiers key.
app/​graphql/​types/​record_type.rb Makes deprecated identifier field resolution safe when identifier data is missing.

Review effort: Lite

@mitlib
mitlib temporarily deployed to timdex-api-p-timx-746-ue0g7ig6 November 12, 2026 14:19 Inactive
@jazairi jazairi self-assigned this Nov 12, 2026
@JPrevost
JPrevost merged commit f31ec5e into main Nov 12, 2026
4 checks passed
@JPrevost
JPrevost deleted the timx-746 branch November 12, 2026 16:05

This branch was previously deployed

1 inactive deployment
timdex-api-p-timx-746-ue0g7ig6 — 342afd5a Deployed Nov 12, 2026 by mitlib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants